/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ufba.lasid.cloud;

import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.StringUtils;

/**
 *
 * @author aliriosa
 */
public class Cloud {

    private String id;
    private List<Datacenter> datacenters;

    public Cloud() {
    }

    public Cloud(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public List<Datacenter> getDatacenters() {
        return datacenters;
    }

    public void setDatacenters(List<Datacenter> datacenters) {
        this.datacenters = datacenters;
    }

    public void addDatacenter(Datacenter dc1) {
        if (this.datacenters == null) {
            this.datacenters = new ArrayList<Datacenter>();
        }
        this.datacenters.add(dc1);
    }

    public Datacenter getDatacenter(String id) {
        for (Datacenter dc : this.datacenters) {
            if (StringUtils.equalsIgnoreCase(dc.getId(), id)) {
                return dc;
            }
        }
        return null;
    }
}
